﻿<%@ Page Language="C#" %>



<script language="C#" runat="server">
    protected void btnTest22(object sender, EventArgs e)
    {
        var h = this.txt_hi.Value;
        Text1.Value = h;
        var hen = Uri.UnescapeDataString(h);
        this.txt_hi.Value = Uri.EscapeDataString(hen);

        this.zhidu.Text = hen;
        
        this.innertext.InnerText = hen;// Server.HtmlEncode(hen);
        this.label_text.Text = "&nbsp;&pound;￥&yen; "; Server.HtmlEncode(hen);
    }
    protected void Page_load(object sender, EventArgs e)
    {
        NameValueCollection nvc = Request.QueryString;
       
        SortedList slist = new SortedList();
        foreach (string name in nvc)
        {
            if (string.Compare(name, "sign", true) == 0)
                continue;

            slist.Add(name, nvc[name]);
        }
     var newsign=   GetVerifySignData(slist);
    }

    public static string GetVerifySignData(SortedList lstParam)
    {
        if (lstParam == null)
            return string.Empty;

        StringBuilder strParam = new StringBuilder();
        //组装签名原始数据
        foreach (DictionaryEntry entry in lstParam)
        {
            if (entry.Value == null || string.IsNullOrEmpty(entry.Value.ToString()))
                continue;

            strParam.AppendFormat("{0}{1}", entry.Key.ToString(), entry.Value.ToString());
        }
        strParam.Append("US12070238043001-00BE");
        //签名Key
        string paraKey = "2bbbe14d22b79be43ce97cd6";

        return SecurityMd5(string.Format("{0}{1}", strParam.ToString().ToLower(), paraKey), "UTF-8");
    }
    public static string SecurityMd5(string str, string encode)
    {
        System.Security.Cryptography.MD5 m5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] fromData = Encoding.GetEncoding(encode).GetBytes(str);
        byte[] targetData = m5.ComputeHash(fromData);
        StringBuilder result = new StringBuilder();
        if (targetData != null)
        {
            for (int i = 0; i < targetData.Length; i++)
            {
                result.Append(targetData[i].ToString("x").PadLeft(2, '0'));
            }
        }
        return result.ToString();
    }

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="shortcut icon" href="http://images001.5173cdn.com/images/common/1y/ico.ico" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <meta name="author" content=" " />
    <meta name="Copyright" content=" " />
    <meta name="Description" content=" " />
    <meta name="Keywords" content=" " />
</head>
<body>
    <%-- <form id="form1" runat="server" accept-charset="utf-8" onsubmit="document.charset='utf-8';">--%>
    <form id="form1" runat="server">
        <div>
            <asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
            <asp:Literal ID="ltlGameInfo" runat="server"></asp:Literal>
            <br />
            <asp:TextBox runat="server" ID="txt" Width="400"></asp:TextBox>
            <br />
            <asp:TextBox runat="server" ID="TextBox1" Width="400"></asp:TextBox>
            <br />
            <input name="txt_hi_" runat="server" id="Text1" value="" style="width: 800px;" />
            <input name="txt_hi" runat="server" id="txt_hi" value="" style="width: 800px;" />
            <br />
            显示问题
            只读文本框<asp:TextBox runat="server" ID="zhidu" />
            innertext <div runat="server" id="innertext"></div>
            label.text <asp:Label ID="label_text" runat="server" />
            <br />
            <label>是否相等</label><span id="xx1"></span>
            <asp:Button ID="Button1" runat="server" Text="mq测试+++++++++++++" OnClick="btnTest22" OnClientClick="wocao();" />
        </div>
        <script type="text/javascript">
            function wocao() {
                document.getElementById("txt_hi").value = encodeURIComponent(document.getElementById("txt").value);
            }
            (function () {
                document.getElementById("TextBox1").value =
                    decodeURIComponent(document.getElementById("txt_hi").value);
                //.replace(/%20/g, " ");
                document.getElementById("xx1").innerHTML =
                    (document.getElementById("TextBox1").value === document.getElementById("txt").value);
            })();
        </script>
    </form>
</body>
</html>
